package com.itheima.d2_xml;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.util.List;

/**
 * 目标：掌握使用Dom4j框架解析XML文件。
 */
public class Dom4JTest1Practice {
    public static void main(String[] args) throws Exception {
        //TODO 将xml文件夹中的contacts.xml内容解析出来

        final SAXReader saxReader = new SAXReader();

        final Document document = saxReader.read("day11properties-xml-log-thread/xml/contacts.xml");
        final Element element = document.getRootElement();


        final List<Element> elements = element.elements("contact");
        for (Element element1 : elements) {
            final List<Element> elements1 = element1.elements();
            for (Element element2 : elements1) {
                System.out.println(element2.getText());
            }
        }

    }


}
